UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x1dPJdPS8M6DABkVvetRcoxn+SKQsGET4RRIzLxaaX0=' 
WHERE 
  key_id = '6b74000bf75370c14349fefea5b36ee0ec60f3fc4ee178c7df6e7931a29fa4f0' 
  AND (
    token = 'x1dPJdPS8M6DABkVvetRcoxn+SKQsGET4RRIzLxaaX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023