UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PFR/pwml0awaLe5LZdZ50cmK4ot+fyzaT4iJpBozI7Y='
WHERE
key_id = 'bf5078e54b87433b58bdbd921a192177cb15d8667f2167d4bfa035ee223ce3b5'
AND (
token = 'PFR/pwml0awaLe5LZdZ50cmK4ot+fyzaT4iJpBozI7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)