UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2b+UI31xwuaUnX7rKOcgiN0NdI2hj2DVDoDGqw9Kjz8='
WHERE
key_id = 'be2ec67f3e6ac986e072ff859357f444dc416aece93b328f7b908bef4c0a7ce9'
AND (
token = '2b+UI31xwuaUnX7rKOcgiN0NdI2hj2DVDoDGqw9Kjz8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)