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