UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XcBQ6FmFwefWvBchvCGHhGdPc9guPYAtpxhHFOkM5Qc='
WHERE
key_id = '729ce9a224484368191b9164d27fb5c2cb1f769ef0c1e97e83ca3cd02ae911bd'
AND (
token = 'XcBQ6FmFwefWvBchvCGHhGdPc9guPYAtpxhHFOkM5Qc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)