UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9Ax9XYY/k00Z198JtDZzWg+mL4TzSHKDidpfyb3m3A='
WHERE
key_id = 'bde7c918cd5e1e22896dd2e0bfa36b702d82024c218be18855306d51abf2404b'
AND (
token = 'C9Ax9XYY/k00Z198JtDZzWg+mL4TzSHKDidpfyb3m3A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)