UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ClgHJ3uHgICwMkPku+GPE/fhtUqveRa9pDB7Y1jT8zw='
WHERE
key_id = 'a00a4006c60e6c0edea3d71c3659db4f56eca44e84eb5cb8e6bcba27859e1b4f'
AND (
token = 'ClgHJ3uHgICwMkPku+GPE/fhtUqveRa9pDB7Y1jT8zw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)