UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CaSaKSP9wi6R+p5OJyP4l138sm1pisy7FNGpb00vJL4=' 
WHERE 
  key_id = '6504df320b858e8fbfeca87ec95eba3aa043d0cd50326d031400b5379f6160fa' 
  AND (
    token = 'CaSaKSP9wi6R+p5OJyP4l138sm1pisy7FNGpb00vJL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030