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