UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hebch2kaYQM7TD8SQd98ZP7Sr1fhKwmU3MfuT1JHvQk='
WHERE
key_id = 'e2a3caf86aaf9a976193581961b22175add5445dd5f40bd5e468b9c75268b213'
AND (
token = 'hebch2kaYQM7TD8SQd98ZP7Sr1fhKwmU3MfuT1JHvQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)