UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bYUcGIkNYhOH+L8vrYONVp5Y/fnz80YsA9smFadIssM='
WHERE
key_id = '661a1bcc97a5e2fbd85d3ee09a47c8ff2ce918ba574d5afa5a8d72a0ba761b16'
AND (
token = 'bYUcGIkNYhOH+L8vrYONVp5Y/fnz80YsA9smFadIssM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)