UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kZPHkcZ5z5WgiIHfZCGNhJjybCQiEWlHKxochuZsg0M=' 
WHERE 
  key_id = 'e83e9b76a555ee19db1720223ac3d0b4a75e1065649043afd79ef07f44d9f400' 
  AND (
    token = 'kZPHkcZ5z5WgiIHfZCGNhJjybCQiEWlHKxochuZsg0M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030