UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QKxEMPCfkQGge4LF6oU0Jw8JdCO+lJbs6KdtrX1D0ys='
WHERE
key_id = '77caf122ac63e74d4844bfcf2d7f2fe49e4c6ff55ea8d4ba6d5a930295bd5247'
AND (
token = 'QKxEMPCfkQGge4LF6oU0Jw8JdCO+lJbs6KdtrX1D0ys='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)