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