UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iH9NluyUxZKsjYkizlGawlunFaUs1aJ74CoqnisHrS4=' 
WHERE 
  key_id = '13bc921746bb4591f2d11b9d7162ef49e6d361f54f998cf61e300bd7f76d263d' 
  AND (
    token = 'iH9NluyUxZKsjYkizlGawlunFaUs1aJ74CoqnisHrS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037