UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sgeo2ga2HhjtNIVD12Cvov61C23NZcIKuG09L7vqGw0=' 
WHERE 
  key_id = '1dc9037d74f97c1936c9014139f5472b263a0d4dbe07e4b39e29d0e7c873670e' 
  AND (
    token = 'Sgeo2ga2HhjtNIVD12Cvov61C23NZcIKuG09L7vqGw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032