UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l+D3pRCZPsferUWrg2R+l+jPoiUPsGZuX+1pBLMeij0=' 
WHERE 
  key_id = '15b1b9588c5f7c99a67e4db7839227eb99a29afde83e0a13699572ca3eb69a8e' 
  AND (
    token = 'l+D3pRCZPsferUWrg2R+l+jPoiUPsGZuX+1pBLMeij0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045