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