UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MBLnaSg4A4plTYruJ9G9h8zRdds9vJlS1AkEdd2p+80='
WHERE
key_id = 'f225cd4b942892e38c2c0f7936fa593d34671ee1236dfa084831629a1dc39fad'
AND (
token = 'MBLnaSg4A4plTYruJ9G9h8zRdds9vJlS1AkEdd2p+80='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)