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