UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DdnqXX7mMwA4zELPbKCoC97+FGF4e1f4evJaIW+nBpI=' 
WHERE 
  key_id = 'c70afa33863842f0748418feae81a254b752e7bd6f731658a5c0b27bb3541aa4' 
  AND (
    token = 'DdnqXX7mMwA4zELPbKCoC97+FGF4e1f4evJaIW+nBpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033