UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o9Ntmv1Alas4xwmD3S1g9q7E7xD4SSFSv7RrIfJtAhk='
WHERE
key_id = '0bd6268544b4c3838cc1c949044f81f117b942d9cd7e187ce494d4c50303d345'
AND (
token = 'o9Ntmv1Alas4xwmD3S1g9q7E7xD4SSFSv7RrIfJtAhk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)