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