UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n1WJHtSCuyA6V9oma5qgGBmvoBthq4JjFAA5a+yCyJM='
WHERE
key_id = 'cd61fe294475a74b02f3fd37301dc8270b8efbb706069855f5004c0793546a57'
AND (
token = 'n1WJHtSCuyA6V9oma5qgGBmvoBthq4JjFAA5a+yCyJM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)