UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UcbqKP+8HRklNvBm1izeZQ+qtTK9msBJ0cr9VxzRiNE='
WHERE
key_id = 'fdd159340fa29502fe48e659ee07a1b3a344d3e075c795748f272a088fbd660c'
AND (
token = 'UcbqKP+8HRklNvBm1izeZQ+qtTK9msBJ0cr9VxzRiNE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)