UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Inr3wGD+Y0qNYFEYUAfXhpb8Rfm3WB1WniMoqmy+SM4=' 
WHERE 
  key_id = 'f532f3917a873105f71439c3b9346a7533d35eb7b94c84fcd18d448fbbc84af0' 
  AND (
    token = 'Inr3wGD+Y0qNYFEYUAfXhpb8Rfm3WB1WniMoqmy+SM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038