UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mWlAt45F8tvuWe92WKQwwEnAwJd27ydpDZBpcU50cQk='
WHERE
key_id = 'e631e48097adda7f3e8d0ca6f24178004b22835afbcf5566ba1c5ebb6b969651'
AND (
token = 'mWlAt45F8tvuWe92WKQwwEnAwJd27ydpDZBpcU50cQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)