UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1Ag4i2ohBUjoKK9otOpkoiMzSuDQBsJ3AxRLKtv+UXo=' 
WHERE 
  key_id = 'd77cc924326f52d86096c62efdd82bdfc96c80c3d148ffe8647de95060a546f1' 
  AND (
    token = '1Ag4i2ohBUjoKK9otOpkoiMzSuDQBsJ3AxRLKtv+UXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00173