UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZjoKQ7fesGuSSS1qHza/I6dAzn3Q5Jz7atCiRFbXefs='
WHERE
key_id = 'bfc7c6e0092d78ec0920f36c0accf132755ee40892c3484134d6025b1e08c2ec'
AND (
token = 'ZjoKQ7fesGuSSS1qHza/I6dAzn3Q5Jz7atCiRFbXefs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)