UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yxl1wYHPegogu70TAaP/jiawacYcOZRVPH2z9S1eUac=' 
WHERE 
  key_id = 'f72e3a5df2e65bc5a894d84713567504216d95d85094914605e34c40ee6f4190' 
  AND (
    token = 'yxl1wYHPegogu70TAaP/jiawacYcOZRVPH2z9S1eUac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039