UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZWwUrGNr9kMeyj2YPINgKGADvt67xu9ABdDtPiVyP9k='
WHERE
key_id = '7ac399f5f016a4fb968b4d02cbe3a97991a7e8931f59c0938c985a04fec0d3a4'
AND (
token = 'ZWwUrGNr9kMeyj2YPINgKGADvt67xu9ABdDtPiVyP9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)