UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQwGDxbMboEvUyvWy1wGY8NGXJyeFFWhFrt4+ZSwhuE=' 
WHERE 
  key_id = 'a849410839a26ab31c6597d70bf6720da7cd4dc0ce250abaa5572b7fd103b85d' 
  AND (
    token = 'PQwGDxbMboEvUyvWy1wGY8NGXJyeFFWhFrt4+ZSwhuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025