UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cHydkl0lAG2pWu2wFsv5KzBgb2GMC07VlyTa3qEDn+0='
WHERE
key_id = '4d9d49177cbb963fee342519f4e02e448db7a57f642f9b1e348593316e4dd1da'
AND (
token = 'cHydkl0lAG2pWu2wFsv5KzBgb2GMC07VlyTa3qEDn+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)