UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N33/8ljfuHtZ9oenqlIaHdAMnItLlg9w5A2NcWmdWGg='
WHERE
key_id = 'e7d50e9765687dc0e22f86b1753a339342801722be2ae49b4d69645bb572f5e5'
AND (
token = 'N33/8ljfuHtZ9oenqlIaHdAMnItLlg9w5A2NcWmdWGg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)